package spring.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Controller
@RequestMapping("/boardList")
public class BoradListController {
    @Autowired
    private BoardListDAO boardListDAO;

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView test(HttpServletRequest req, HttpServletResponse response) throws IOException {
        System.out.println("BoradList");

        List<BoardListVo> list = boardListDAO.findAll();
        for (BoardListVo b : list) {
            System.out.println(b.toString());
        }

        return new ModelAndView("boardList", "boardList", list);
    }
}
